package com.yinhe.music.yhmusic.localmusic.view;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

import com.yinhe.music.yhmusic.R;
import com.yinhe.music.yhmusic.base.BasePresenter;
import com.yinhe.music.yhmusic.base.BaseServiceActivity;


/**
 * @author 何晓华
 */
public class LocalSingerActivity extends BaseServiceActivity {

    String singerName;

    @Override
    public void initView() {
        getData();
        setToolbar(singerName);
        setMusicList();
        showQuickControl(true);
    }

    @Override
    public int getLayoutResId() {
        return R.layout.activity_collection_radio;
    }

    @Override
    public BasePresenter getPresenter() {
        return null;
    }

    @Override
    public void initPresenter() {

    }

    private void getData() {
        if (getIntent() != null) {
            singerName = getIntent().getStringExtra("singerName");
//            path = getIntent().getStringExtra("path");
//            id = getIntent().getLongExtra("id", 0);
//            type = getIntent().getIntExtra("type", -1);
        }
//        List<Music> musicList = CacheManager.getInstance().getScanMusic();
//        if (musicList != null) {
//            switch (type) {
//                case IConstants.LOCAL_ALBUM:
//                    singerSong = MusicUtils.getAlbumSong(musicList, id);
//                    break;
//                case IConstants.LOCAL_FILE:
//                    singerSong = MusicUtils.getFileSong(musicList, path);
//                    break;
//                case IConstants.LOCAL_SINGER:
//                    singerSong = MusicUtils.getSingerSong(musicList, id);
//                    break;
//                default:
//                    break;
//            }
//        }
    }

    private void setMusicList(){
        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction tx = fm.beginTransaction();
        tx.add(R.id.FrameLayout, LocalMusicFragment.newInstance(true));
        tx.commit();
    }
}
